<?php

/*
	info: 获取活动详情
*/

define('IS_MEMBER_CHECK', TRUE);
require '../common.inc.php';

/*
global_CheckPost(
	array(
		array('id','int','@>0',$weblang['api_notHaveActivity'],1),
));

if (!empty($webglobal['CPM']))
{
	$return['code'] = 1;
	$return['msg'] = reset($webglobal['CPM']);
	api_EchoReturn();
}
*/

$webglobal['CPP']['id'] = api_GetTopActivityID();
$webglobal['codeinfo'] = $db->GetOne("SELECT * FROM promotion_user WHERE pid='{$webglobal['CPP']['id']}' AND uid='{$user['m_uid']}'");
if (empty($webglobal['codeinfo']))
{
	api_EchoReturn($weblang['api_codeError']);
}

$webglobal['datainfo'] = $db->GetOne("SELECT * FROM promotion WHERE id='{$webglobal['CPP']['id']}'");

if (empty($webglobal['datainfo']))
{
	api_EchoReturn($weblang['api_notHaveActivity']);
}
$tempcontent = api_FormatContent($webglobal['datainfo']['content'], $webglobal['codeinfo']['codetime']);
$return['code'] = 0;
$return['data']['activity'] = array(
	'id' => $webglobal['datainfo']['id'],
	'title' => $webglobal['datainfo']['title'],
	'giftpic' => $webconfig['webimageurl'].$webglobal['datainfo']['gifpic'],
	'giftinfo' => $webglobal['datainfo']['giftinfo'],
	'showimg' => $webconfig['webimageurl'].$webglobal['datainfo']['showimg'],
	'preface' => $tempcontent[0],
	'content' => $tempcontent[1],
);
api_EchoReturn();
